HAL SPDIFRX migration: List of applicable concepts

This section provides information about the HAL SPDIFRX applicable architecture concepts.

Concepts for SPDIFRX

Concept

Description

Separation of initialization and configuration functions

The initialization has been split into separate initialization and configuration functions:

  • HAL_SPDIFRX_Init() to initialize the SPDIFRX according to the associated handle.

  • HAL_SPDIFRX_SetConfig() to set the configuration of the SPDIFRX peripheral.

Removal and conversion of init structure to configuration structure

The initialization structure SPDIFRX_InitTypeDef has been removed from the handle and moved into the hal_spdifrx_config_t structure.

Renaming of the handle structure

The handle structure has been renamed to hal_spdifrx_handle_t.

Renaming unitary init structures

The structure SPDIFRX_InitTypeDef has been replaced by hal_spdifrx_config_t.

Remove MspInit and MspDeInit callbacks

The functions hal_spdifrx_MspInit() and hal_spdifrx_MspDeInit() have been removed and replaced by a user-defined sequence for SPDIFRX initialization and configuration.

Unitary configuration APIs

New APIs have been introduced to get and set SPDIFRX features.

Dedicated DMA link APIs replace generic __HAL_LINKDMA macro

In HAL2, DMA link APIs are provided with explicit naming and parameters : HAL_SPDIFRX_SetDataDMA() and HAL_SPDIFRX_SetControlDMA().

Individual callback registration APIs replace global register and unregister functions

Split global register callback SPDIFRX into one register per callback and remove unregister callback SPDIFRX.

Removal of hardware-related macros in HAL2

All hardware macros have been removed from the HAL SPDIFRX driver, and equivalent services are converted into HAL static inline APIs.

Revised and optimized HAL state machine

The SPDIFRX state machine has been reworked to ensure transitions between the peripherals functional states.

Revised and optimized HAL API status returns

The HAL SPDIFRX functions were updated to return:

  • HAL_INVALID_PARAM: in case of a NULL p_config structure pointer.

  • HAL_ERROR: in case of an error.

  • HAL_BUSY: in case of an ongoing process.

  • HAL_OK: in case of a successfully completed operation.

Revised and optimized HAL error management

Update the error management function to HAL_SPDIFRX_GetLastErrorCodes().

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL SPDIFRX driver have been removed and replaced by _t.

Assertion implementation and usage in HAL1

The ASSERT_DBG_STATE and ASSERT_DBG_PARAM macros are used to check the parameters and state of the HAL SPDIFRX driver.

Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency.

The HAL SPDIFRX driver provides a new API to retrieve the clock frequency: HAL_SPDIFRX_GetClockFreq().

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Finite parameters (including SPDIFRX instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety.

Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).

All HAL SPDIFRX functions start with HAL_SPDIFRX_.

Other HAL SPDIFRX changes

Concept

Consideration

Remove HAL_SPDIFRX_DMAStop() and replace it by HAL_SPDIFRX_Data_Abort() and HAL_SPDIFRX_Ctrl_Abort()

There is no start DMA API in SPDIFRX.